package zhh.tangbao.syslog.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zhh.tangbao.syslog.dto.SystemLogDto;
import zhh.tangbao.syslog.service.SystemLogService;
import zhh.tangbao.syslog.vo.SystemLogPageVo;
import zhh.tangbao.system.annotation.Authority;
import zhh.tangbao.system.constant.AuthorityModel;
import zhh.tangbao.system.entity.PagerEntity;
import zhh.tangbao.system.result.Result;

/**
 * @author 粥灰灰
 * @created 2022/10/1
 * @version 1.0
 * @Description 描述
 */

@RestController
@RequestMapping("/api/log")
public class SystemLogController {
    @Autowired
    private SystemLogService service;

    @GetMapping("/page")
    @Authority(authorities = "admin", authorityModel = AuthorityModel.CONTAIN)
    public Result page(PagerEntity<SystemLogPageVo> pager, SystemLogDto dto) {
        return Result.success().put(service.page(pager, dto));
    }

    @GetMapping("/modules")
    @Authority(authorities = "admin", authorityModel = AuthorityModel.CONTAIN)
    public Result modules() {
        return Result.success().put(service.modules());
    }
}
